﻿using System;
using System.Web.UI;
using UDS.Entity;

namespace UDS.SubModule.Position
{
    /// <summary>
    /// UpdateCaste 的摘要说明。
    /// </summary>
    public partial class UpdateCastePage : Page
    {
        protected int PositionID
        {
            get;
            private set;
        }

        protected override void OnInit(EventArgs e)
        {
            cmdOK.Click += cmdOK_Click;
            cmdReturn.Click += cmdReturn_Click;
            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            PositionID = QSUtil.GetPositiveInt32("PositionID", 0);
            if (!Page.IsPostBack)
            {
                PositionInfo p = UDS.Components.Position.GetPositionInfo(PositionID);
                labPositionName.Text = (p == null) ? string.Empty : p.Name;
            }

            base.OnLoad(e);
        }

        private void cmdReturn_Click(object sender, EventArgs e)
        {
            Server.Transfer("Listview.aspx?PositionID=" + PositionID);
        }

        private void cmdOK_Click(object sender, EventArgs e)
        {
            Components.Position.UpdateCaste(PositionID, Int32.Parse(tbNewCaste.Text));

            Response.Write("<script language=''>alert('批量修改职级成功！');</script>");
        }
    }
}